'use strict';
const db = uniCloud.database();
exports.main = async (event, context) => {
	console.log(event)
	if(event.type == 0) {
		const collection = db.collection('opendb-city-china')
		const res = await collection.where({'type':0}).get();
		return res
	} else if(event.type == 1) {
		const collection = db.collection('opendb-city-china')
		const res = await collection.where({'type':1, 'parent_code':event.parentCode}).get();
		return res
	} else if(event.type == 2) {
		const collection = db.collection('opendb-city-china')
		const res = await collection.where({'type':2, 'parent_code':event.parentCode}).get();
		return res
	}

};
